

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/favicon.png">
  <link rel="icon" href="/img/favicon.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="Fly542">
  <meta name="keywords" content="">
  
    <meta name="description" content="用户根目录下~&#x2F;.vimrc 配置文件内容 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939">
<meta property="og:type" content="article">
<meta property="og:title" content="vimrc配置文件">
<meta property="og:url" content="http://fly542.cn/2020/07/30/04DevOps/03vimrc%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6/index.html">
<meta property="og:site_name" content="Fly542 技术沉淀">
<meta property="og:description" content="用户根目录下~&#x2F;.vimrc 配置文件内容 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-07-30T07:00:02.000Z">
<meta property="article:modified_time" content="2022-12-30T03:33:01.423Z">
<meta property="article:author" content="Fly542">
<meta property="article:tag" content="开发机">
<meta name="twitter:card" content="summary_large_image">
  
  
  <title>vimrc配置文件 - Fly542 技术沉淀</title>

  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4/dist/css/bootstrap.min.css" />


  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/github-markdown-css@4/github-markdown.min.css" />
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/hint.css@2/hint.min.css" />

  
    
    
      
      <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js@10/styles/github-gist.min.css" />
    
  

  
    <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3/dist/jquery.fancybox.min.css" />
  


<!-- 主题依赖的图标库，不要自行修改 -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_ba1fz6golrf.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />

<!-- 自定义样式保持在最底部 -->


  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    var CONFIG = {"hostname":"fly542.cn","root":"/","version":"1.8.14","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"right","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"copy_btn":true,"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml"};
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
<meta name="generator" content="Hexo 6.0.0"></head>


<body>
  <header style="height: 70vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>Fly542 技术沉淀</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              &nbsp;<i class="iconfont icon-search"></i>&nbsp;
            </a>
          </li>
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="banner" id="banner" parallax=true
         style="background: url('/img/default.png') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
          <div class="page-header text-center fade-in-up">
            <span class="h2" id="subtitle" title="vimrc配置文件">
              
            </span>

            
              <div class="mt-3">
  
  
    <span class="post-meta">
      <i class="iconfont icon-date-fill" aria-hidden="true"></i>
      <time datetime="2020-07-30 15:00" pubdate>
        2020年7月30日 下午
      </time>
    </span>
  
</div>

<div class="mt-1">
  
    <span class="post-meta mr-2">
      <i class="iconfont icon-chart"></i>
      7.8k 字
    </span>
  

  
    <span class="post-meta mr-2">
      <i class="iconfont icon-clock-fill"></i>
      
      
      66 分钟
    </span>
  

  
  
</div>

            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div class="py-5" id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">vimrc配置文件</h1>
            
            <div class="markdown-body">
              <p>用户根目录下~/.vimrc 配置文件内容</p>
<figure class="highlight 1c"><table><tr><td class="gutter"><div class="code-wrapper"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br></pre></div></td><td class="code"><pre><code class="hljs 1c">set nu<br>set tabstop=<span class="hljs-number">4</span><br>set softtabstop=<span class="hljs-number">4</span><br>set shiftwidth=<span class="hljs-number">4</span><br>set expandtab<br>set cinoptions=g0<br>set colorcolumn=<span class="hljs-number">81</span><br>set fileencodings=ucs-bom,utf-<span class="hljs-number">8</span>,cp936,gb18030,big5,euc-jp,euc-kr,latin1<br>set nocompatible            <span class="hljs-string">&quot; 关闭 vi 兼容模式</span><br>syntax on                   <span class="hljs-string">&quot; 自动语法高亮</span><br><span class="hljs-string">&quot;set paste                   &quot;</span> 取消粘贴自动注释<br>set number                  <span class="hljs-string">&quot; 显示行号</span><br>set cursorline              <span class="hljs-string">&quot; 突出显示当前行</span><br>set ruler                   <span class="hljs-string">&quot; 打开状态栏标尺</span><br>set nobackup                <span class="hljs-string">&quot; 覆盖文件时不备份</span><br>set autochdir               <span class="hljs-string">&quot; 自动切换当前目录为当前文件所在的目录</span><br>filetype plugin indent on   <span class="hljs-string">&quot; 开启插件</span><br>set backupcopy=yes          <span class="hljs-string">&quot; 设置备份时的行为为覆盖</span><br>set hlsearch                <span class="hljs-string">&quot; 搜索时高亮显示被找到的文本</span><br>set noerrorbells            <span class="hljs-string">&quot; 关闭错误信息响铃</span><br>set novisualbell            <span class="hljs-string">&quot; 关闭使用可视响铃代替呼叫</span><br>set t_vb=                   <span class="hljs-string">&quot; 置空错误铃声的终端代码</span><br>set showmatch               <span class="hljs-string">&quot; 插入括号时，短暂地跳转到匹配的对应括号</span><br>set matchtime=<span class="hljs-number">1</span>             <span class="hljs-string">&quot; 短暂跳转到匹配括号的时间</span><br>set magic                   <span class="hljs-string">&quot; 设置魔术</span><br>set guioptions-=T           <span class="hljs-string">&quot; 隐藏工具栏</span><br>set guioptions-=m           <span class="hljs-string">&quot; 隐藏菜单栏</span><br>set completeopt=menu        <span class="hljs-string">&quot; 关闭scratch 预览窗口</span><br>set backspace=indent,eol,start<br>set cmdheight=<span class="hljs-number">1</span>             <span class="hljs-string">&quot; 设定命令行的行数为</span><br>set t_Co=<span class="hljs-number">256</span>                <span class="hljs-string">&quot; 让xshell 也支持vim的256色配色方案</span><br>set nomodeline              <span class="hljs-string">&quot; 关闭 model</span><br>set tags=./.tags;,.tags<br><span class="hljs-string">&quot; set tags+=../.tag</span><br><span class="hljs-string">&quot; set tags+=../../.tag</span><br><span class="hljs-string">&quot; set tags+=../../../.tag</span><br><span class="hljs-string">&quot; set tags+=../*/.tag</span><br><span class="hljs-string">&quot; set tags+=../*/*/.tag</span><br><span class="hljs-string">&quot; set tags+=../../*/*/.tag</span><br>set foldcolumn=<span class="hljs-number">0</span><br>setlocal foldlevel=<span class="hljs-number">2</span><br>set foldclose=all <span class="hljs-string">&quot; 设置为折叠</span><br>set nofoldenable  <span class="hljs-string">&quot; 设置为自动关闭折叠</span><br>set laststatus=<span class="hljs-number">2</span>      <span class="hljs-string">&quot; 总是显示状态栏</span><br>nnoremap &lt;space&gt; @=((foldclosed(line(&#x27;.&#x27;)) &lt; <span class="hljs-number">0</span>) ? &#x27;zc&#x27; : &#x27;zo&#x27;)&lt;CR&gt;<br><span class="hljs-string">&quot; 用空格键来开关折叠</span><br><span class="hljs-string">&quot;让vim记忆上次编辑的位置</span><br>autocmd BufReadPost *<br>            \ if line(<span class="hljs-string">&quot;&#x27;\&quot;&quot;)&gt;0&amp;&amp;line(&quot;</span>&#x27;\&quot;&quot;)&lt;=line(&quot;$&quot;) |<br>            \ exe &quot;normal g&#x27;\<span class="hljs-string">&quot;&quot;</span> <span class="hljs-string">|</span><br>            \ endif<br><span class="hljs-string">&quot;让vim记忆上次编辑的位置</span><br><span class="hljs-string">&quot; 警戒线颜色设置</span><br>highlight ColorColumn ctermfg=green ctermbg=red<br>highlight LineNr cterm=none ctermfg=green ctermbg=darkblue<br>highlight SpellBad ctermfg=<span class="hljs-number">15</span> ctermbg=<span class="hljs-number">1</span> guifg=White guibg=Red<br><span class="hljs-string">&quot; 搜索背景色设置</span><br>highlight Search cterm=none ctermfg=yellow ctermbg=red<br><span class="hljs-string">&quot; 下拉菜单背景色设置</span><br>highlight Pmenu ctermbg=green<br><span class="hljs-string">&quot; 下拉菜单选择行的背景色设置</span><br>highlight PmenuSel ctermbg=red ctermfg=yellow<br><span class="hljs-string">&quot; vimdiff 背景色设置</span><br>highlight DiffAdd     term=bold ctermfg=<span class="hljs-number">232</span> ctermbg=<span class="hljs-number">214</span><br>highlight DiffChange  term=bold ctermbg=<span class="hljs-number">248</span><br>highlight DiffDelete  term=reverse ctermfg=<span class="hljs-number">15</span> ctermbg=<span class="hljs-number">2</span><br>highlight DiffText    term=reverse ctermfg=<span class="hljs-number">15</span> ctermbg=<span class="hljs-number">1</span> gui=undercurl guifg=White guibg=Red guisp=Red<br><span class="hljs-string">&quot;highlight DiffText    term=reverse cterm=bold ctermbg=9</span><br><br><span class="hljs-string">&quot; set the runtime path to include Vundle and initialize</span><br>set rtp+=<span class="hljs-symbol">~/.vim/bundle/Vundle.vim</span><br><span class="hljs-symbol">call vundle#begin()</span><br><span class="hljs-symbol"></span><br><span class="hljs-symbol">&quot; 让vundle管理插件版本,必须</span><br><span class="hljs-symbol">Plugin &#x27;VundleVim/Vundle.vim&#x27;</span><br><span class="hljs-symbol">&quot; 自动生成ctags索引</span><br><span class="hljs-symbol">Plugin &#x27;ludovicchabant/vim-gutentags&#x27;</span><br><span class="hljs-symbol">&quot; 提供ctags数据库无缝切换</span><br><span class="hljs-symbol">Plugin &#x27;skywind3000/gutentags_plus&#x27;</span><br><span class="hljs-symbol">&quot; vim支持markdown</span><br><span class="hljs-symbol">&quot;Plugin &#x27;plasticboy/vim-markdown&#x27;</span><br><span class="hljs-symbol">&quot; vim markdown 生成表格</span><br><span class="hljs-symbol">Plugin &#x27;dhruvasagar/vim-table-mode&#x27;</span><br><span class="hljs-symbol">&quot; 配合snippets自动补全, 没有的话snippets不生效</span><br><span class="hljs-symbol">Plugin &#x27;SirVer/ultisnips&#x27;</span><br><span class="hljs-symbol">&quot; 支持代码片段</span><br><span class="hljs-symbol">Plugin &#x27;honza/vim-snippets&#x27;</span><br><span class="hljs-symbol">&quot; 状态栏显示不同颜色</span><br><span class="hljs-symbol">Plugin &#x27;Lokaltog/vim-powerline&#x27;</span><br><span class="hljs-symbol">&quot; 记录历史变量名或路径或符号，使用tab即可循环选择</span><br><span class="hljs-symbol">Plugin &#x27;ervandew/supertab&#x27;</span><br><span class="hljs-symbol">&quot; 支持语法检测和编码风格检测</span><br><span class="hljs-symbol">Plugin &#x27;scrooloose/syntastic&#x27;</span><br><span class="hljs-symbol">&quot; 设置对齐线</span><br><span class="hljs-symbol">Plugin &#x27;Yggdroot/indentLine&#x27;</span><br><span class="hljs-symbol">&quot; git项目编辑后在行前显示状态~ + - 等</span><br><span class="hljs-symbol">Plugin &#x27;airblade/vim-gitgutter&#x27;</span><br><span class="hljs-symbol">&quot; 代码对齐</span><br><span class="hljs-symbol">Plugin &#x27;godlygeek/tabular&#x27;</span><br><span class="hljs-symbol">&quot; nerdtree</span><br><span class="hljs-symbol">Plugin &#x27;scrooloose/nerdtree&#x27;</span><br><span class="hljs-symbol">&quot; git管理的项目在项目窗口中的状态标识</span><br><span class="hljs-symbol">Plugin &#x27;git</span>:<span class="hljs-comment">//github.com/Xuyuanp/nerdtree-git-plugin.git&#x27;</span><br><span class="hljs-string">&quot; 文件查找工具，使用\ t查找文件</span><br>Plugin &#x27;wincent/command-t&#x27;<br><span class="hljs-string">&quot; vim 状态栏插件</span><br>Plugin &#x27;bling/vim-airline&#x27;<br><span class="hljs-string">&quot; 代码格式化插件</span><br>Plugin &#x27;Chiel92/vim-autoformat&#x27;<br>Plugin &#x27;rdnetto/YCM-Generator&#x27;<br><span class="hljs-string">&quot; 代码补全</span><br>Plugin &#x27;Valloric/YouCompleteMe&#x27;<br><span class="hljs-string">&quot; rust</span><br>Plugin &#x27;rust-lang/rust.vim&#x27;<br><span class="hljs-string">&quot; toml文件语法</span><br>Plugin &#x27;cespare/vim-toml&#x27;<br><br>call vundle<span class="hljs-meta">#end()            &quot; 必须</span><br>filetype plugin indent on    <span class="hljs-string">&quot; 必须 加载vim自带和插件相应的语法和文件类型相关脚本</span><br><br>autocmd BufNewFile  *.c,*.cpp  <span class="hljs-number">0</span>r <span class="hljs-symbol">~/.vim/skeleton/c.ske</span><br><span class="hljs-symbol">autocmd BufNewFile  *.h,*.hpp  0r ~/.vim/skeleton/h.ske</span><br><span class="hljs-symbol">autocmd BufNewFile  *.sh       0r ~/.vim/skeleton/sh.ske</span><br><span class="hljs-symbol">autocmd BufNewFile * normal G</span><br><span class="hljs-symbol">autocmd BufNewFile *.[ch],*.sh,*.hpp,*.cpp ks|call CreatedTime()|&#x27;</span><br><span class="hljs-symbol">fun CreatedTime()</span><br><span class="hljs-symbol">    if line(&quot;$&quot;) &gt; 20</span><br><span class="hljs-symbol">        let l = 20</span><br><span class="hljs-symbol">    else</span><br><span class="hljs-symbol">        let l = line(&quot;$&quot;)</span><br><span class="hljs-symbol">    endif</span><br><span class="hljs-symbol">    exe &quot;1,&quot; . l . &quot;g/Date       </span>:.*/s<span class="hljs-comment">//Date       : &quot; .strftime(&quot;%c&quot;)</span><br>endfun<br><br><span class="hljs-string">&quot; 保存时自动删除行尾空白字符</span><br>function! StripTrailingWhitespace()<br>    normal mZ<br>    %s/\s\+$<span class="hljs-comment">//e</span><br>    if line(<span class="hljs-string">&quot;&#x27;Z&quot;</span>) != line(<span class="hljs-string">&quot;.&quot;</span>)<br>        echo <span class="hljs-string">&quot;Stripped whitespace\n&quot;</span><br>    endif<br>    normal `Z<br>endfunction<br>autocmd BufWritePre *.cpp,*.cxx,*.hpp,*.h,*.rs,*.toml :call StripTrailingWhitespace()<br><br><span class="hljs-string">&quot; 设置nerd窗口中git文件状态</span><br>let g:NERDTreeIndicatorMapCustom = &#123;<br>    \ <span class="hljs-string">&quot;Modified&quot;</span>  : <span class="hljs-string">&quot;✹&quot;</span>,<br>    \ <span class="hljs-string">&quot;Staged&quot;</span>    : <span class="hljs-string">&quot;✚&quot;</span>,<br>    \ <span class="hljs-string">&quot;Untracked&quot;</span> : <span class="hljs-string">&quot;✭&quot;</span>,<br>    \ <span class="hljs-string">&quot;Renamed&quot;</span>   : <span class="hljs-string">&quot;➜&quot;</span>,<br>    \ <span class="hljs-string">&quot;Unmerged&quot;</span>  : <span class="hljs-string">&quot;═&quot;</span>,<br>    \ <span class="hljs-string">&quot;Deleted&quot;</span>   : <span class="hljs-string">&quot;✖&quot;</span>,<br>    \ <span class="hljs-string">&quot;Dirty&quot;</span>     : <span class="hljs-string">&quot;✗&quot;</span>,<br>    \ <span class="hljs-string">&quot;Clean&quot;</span>     : <span class="hljs-string">&quot;✔︎&quot;</span>,<br>    \ <span class="hljs-string">&quot;Unknown&quot;</span>   : <span class="hljs-string">&quot;?&quot;</span><br>    \ &#125;<br><br><span class="hljs-string">&quot; 自动关闭选项预览窗口</span><br>autocmd InsertLeave * if pumvisible() == <span class="hljs-number">0</span><span class="hljs-string">|pclose|endif</span><br>autocmd CursorMovedI * if pumvisible() == <span class="hljs-number">0</span><span class="hljs-string">|pclose|endif</span><br><br><span class="hljs-string">&quot;YouCompleteMe相关设置</span><br><span class="hljs-string">&quot;let g:ycm_global_ycm_extra_conf=&#x27;~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py&#x27;</span><br>let g:ycm_global_ycm_extra_conf=&#x27;~/.ycm_extra_conf.py&#x27;<br><span class="hljs-string">&quot;开启语义补全</span><br>let g:ycm_seed_identifiers_with_syntax=<span class="hljs-number">1</span><br><span class="hljs-string">&quot;不显示开启vim时检查ycm_extra_conf文件的信息</span><br>let g:ycm_confirm_extra_conf=<span class="hljs-number">0</span><br><span class="hljs-string">&quot;每次重新生成匹配项，禁止缓存匹配项</span><br>let g:ycm_cache_omnifunc=<span class="hljs-number">0</span><br><span class="hljs-string">&quot; 从第2个键入字符就开始罗列匹配项</span><br>let g:ycm_min_num_of_chars_for_completion=<span class="hljs-number">2</span>                 <span class="hljs-string">&quot;</span><br><span class="hljs-string">&quot;不查询ultisnips提供的代码模板补全，如果需要，设置成1即可</span><br>let g:ycm_use_ultisnips_completer=<span class="hljs-number">0</span><br>let g:ycm_key_list_select_completion = [&#x27;&lt;c-n&gt;&#x27;, &#x27;&lt;Down&gt;&#x27;]<br>let g:ycm_enable_diagnostic_signs = <span class="hljs-number">0</span><br>let g:ycm_enable_diagnostic_highlighting = <span class="hljs-number">0</span><br><br><span class="hljs-string">&quot;设置对齐线的颜色</span><br>let g:indentLine_color_term = <span class="hljs-number">239</span><br><span class="hljs-string">&quot; 设置</span><br>let g:airline<span class="hljs-meta">#extensions#tabline#enabled = 1</span><br>let NERDTreeWinPos=<span class="hljs-number">1</span>   <span class="hljs-string">&quot; 右侧显示</span><br><br><span class="hljs-string">&quot; 设置markdown的table模式下使用|进行表格制作</span><br>let g:table_mode_corner=&#x27;|&#x27;<br><br><span class="hljs-string">&quot; gutentags 搜索工程目录的标志，碰到这些文件/目录名就停止向上一级目录递归</span><br>let g:gutentags_project_root = [&#x27;.root&#x27;, &#x27;.svn&#x27;, &#x27;.git&#x27;, &#x27;.hg&#x27;, &#x27;.project&#x27;]<br><br><span class="hljs-string">&quot; 所生成的数据文件的名称</span><br>let g:gutentags_ctags_tagfile = &#x27;.tags&#x27;<br><br><span class="hljs-string">&quot; 将自动生成的 tags 文件全部放入 ~/.cache/tags 目录中，避免污染工程目录</span><br>let s:vim_tags = expand(&#x27;~/.cache/tags&#x27;)<br>let g:gutentags_cache_dir = s:vim_tags<br><span class="hljs-string">&quot; 检测 ~/.cache/tags 不存在就新建 &quot;</span><br>if !isdirectory(s:vim_tags)<br>    silent! call mkdir(s:vim_tags, &#x27;p&#x27;)<br>endif<br><br><span class="hljs-string">&quot; 配置 ctags 的参数</span><br>let g:gutentags_ctags_extra_args = [&#x27;--fields=+niazS&#x27;, &#x27;--extra=+q&#x27;]<br>let g:gutentags_ctags_extra_args += [&#x27;--c++-kinds=+px&#x27;]<br>let g:gutentags_ctags_extra_args += [&#x27;--c-kinds=+px&#x27;]<br><br><span class="hljs-string">&quot; 设置NerdTree F3调出</span><br>map &lt;F3&gt; :NERDTreeMirror&lt;CR&gt;<br>map &lt;F3&gt; :NERDTreeToggle&lt;CR&gt;<br><span class="hljs-string">&quot; 设置f4为代码自动格式化，配合插件vim-autoformat使用</span><br>noremap &lt;F4&gt; :Autoformat&lt;CR&gt;<br><span class="hljs-string">&quot; 设置f9打开或关闭对齐线</span><br>map &lt;F9&gt; :IndentLinesToggle&lt;CR&gt;<br><span class="hljs-string">&quot; 设置,2 ,3 ,4 分别为vimdiff的获取2 3 4 窗口内容, 并更新vimdiff</span><br>map &lt;silent&gt; ,<span class="hljs-number">2</span> :diffget <span class="hljs-number">2</span>&lt;CR&gt; :diffupdate&lt;CR&gt;<br>map &lt;silent&gt; ,<span class="hljs-number">3</span> :diffget <span class="hljs-number">3</span>&lt;CR&gt; :diffupdate&lt;CR&gt;<br>map &lt;silent&gt; ,<span class="hljs-number">4</span> :diffget <span class="hljs-number">4</span>&lt;CR&gt; :diffupdate&lt;CR&gt;<br><br>autocmd BufEnter * if <span class="hljs-meta">&amp;filetype == &quot;&quot; | setlocal ft=cpp | endif</span><br>nnoremap &lt;leader&gt;jd :YcmCompleter GoToDeclaration&lt;CR&gt;<br><br><span class="hljs-string">&quot; 在输入模式下ctrl+hjkl  来移动光标, 一般需要修改xshell中属性终端里 127 把&lt;BS&gt;设置成 127，而 &lt;DEL&gt;设置成 VT220 Del</span><br>inoremap &lt;c-h&gt; &lt;left&gt;<br>inoremap &lt;c-j&gt; &lt;down&gt;<br>inoremap &lt;c-k&gt; &lt;up&gt;<br>inoremap &lt;c-l&gt; &lt;right&gt;<br><span class="hljs-string">&quot;inoremap &#x27; &#x27;&#x27;&lt;ESC&gt;i</span><br><span class="hljs-string">&quot;inoremap &quot;</span> <span class="hljs-string">&quot;&quot;</span>&lt;ESC&gt;i<br><span class="hljs-string">&quot; inoremap ( ()&lt;ESC&gt;i</span><br><span class="hljs-string">&quot; inoremap [ []&lt;ESC&gt;i</span><br><span class="hljs-string">&quot; inoremap &#123; &#123;&lt;CR&gt;&#125;&lt;ESC&gt;O</span><br></code></pre></td></tr></table></figure>
            </div>
            <hr>
            <div>
              <div class="post-metas mb-3">
                
                  <div class="post-meta mr-3">
                    <i class="iconfont icon-category"></i>
                    
                      <a class="hover-with-bg" href="/categories/devops/">devops</a>
                    
                  </div>
                
                
                  <div class="post-meta">
                    <i class="iconfont icon-tags"></i>
                    
                      <a class="hover-with-bg" href="/tags/%E5%BC%80%E5%8F%91%E6%9C%BA/">开发机</a>
                    
                  </div>
                
              </div>
              
                <p class="note note-warning">
                  
                    本博客所有文章除特别声明外，均采用 <a target="_blank" href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh" rel="nofollow noopener noopener">CC BY-SA 4.0 协议</a> ，转载请注明出处！
                  
                </p>
              
              
                <div class="post-prevnext">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2020/07/30/03%E8%BD%AF%E4%BB%B6%E5%BC%80%E5%8F%91/03linux/02awk%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95/">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">awk常用方法</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2020/07/30/04DevOps/01%E5%BC%80%E5%8F%91%E6%9C%BA%E9%83%A8%E7%BD%B2/">
                        <span class="hidden-mobile">开发机部署</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
    

    
  </main>

  <footer class="text-center mt-5 py-3">
  <div class="footer-content">
     <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
  </div>
  

  

  
</footer>


  <!-- SCRIPTS -->
  
  <script  src="https://cdn.jsdelivr.net/npm/nprogress@0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nprogress@0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js" ></script>
<script  src="https://cdn.jsdelivr.net/npm/bootstrap@4/dist/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>

<!-- Plugins -->


  <script  src="/js/local-search.js" ></script>



  
    <script  src="/js/img-lazyload.js" ></script>
  



  



  
    <script  src="https://cdn.jsdelivr.net/npm/tocbot@4/dist/tocbot.min.js" ></script>
  
  
    <script  src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3/dist/jquery.fancybox.min.js" ></script>
  
  
    <script  src="https://cdn.jsdelivr.net/npm/anchor-js@4/anchor.min.js" ></script>
  
  
    <script defer src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js" ></script>
  






  <script  src="https://cdn.jsdelivr.net/npm/typed.js@2/lib/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var title = document.getElementById('subtitle').title;
      
        typing(title);
      
    })(window, document);
  </script>















<!-- 主题的启动项 保持在最底部 -->
<script  src="/js/boot.js" ></script>


</body>
</html>
